##################################################################
## if 三元表达式
mood = "hello" if 1
if 1 and "str" == "str"
    console.log "jrp"
else
    console.log "dr"
date = if "hello" then "world" else "jrp"
##################################################################
## Loop and Comprehensions(推导式); for 后面要接 when, 不能是 if
# CoffeeScript is collecting the result of each iteration into an array
console.log food for food in ['toast', 'cheese', 'wine']
console.log i + 1, dish for dish, i in ['greens', 'caviar']  # 第二个参数指定 index
console.log food for food in ['broccoli', 'spinach', 'chocolate'] when food isnt 'chocolate'
evens = (x for x in [10..1] by -2 when x < 7); console.log evens  # by 指定步长
console.log "#{child} is #{age}" for child, age of max: 10, ida: 9, tim: 11  # in -> list, of -> dict
# 下面两种 while 写法, 第一种返回的是一个 list, 第二种返回的是 str
num = 6;
lyrics = while num -= 1
    "#{num} little monkeys"
num = 6; lyrics = "#{num} little monkeys" while num -= 1; console.log lyrics  # 1 little monkeys
